﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AllPosts.aspx.cs" Inherits="WebAppTest.Forum.AllPosts" MasterPageFile="~/Forum/Forum.Master" %>

<asp:Content ID="content" runat="server" ContentPlaceHolderID="MainContent">
    <a href="NewPost.aspx" id="newPost">Add post</a>
    <asp:GridView ID="grdPosts" runat="server" AutoGenerateColumns="false" Width="50%" 
        AllowSorting="true" OnSorting="grdPosts_Sorting">
        <Columns>
            <asp:BoundField DataField="Date" DataFormatString="{0:yyyy.MM.dd}" HeaderText="Date" />
            <asp:BoundField DataField="Author" HeaderText="Author" SortExpression="Author" />
            <asp:TemplateField HeaderText="Subject" SortExpression="Subject">
                <ItemTemplate>
                    <a href="ViewPost.aspx?index=<%# Container.DataItemIndex %>"><%# Eval("Subject") %></a>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
</asp:Content>